<template>
    <div class="unitBar">
        <div class="componentTitle">这是piniaInput.vue子组件</div>
        <div class="componentInfo">
            <div>
                <input type="text" v-model="inputVa" placeholder="输入双向绑定的值"><span>{{inputVa}}</span>
            </div>
            <div>
                <input type="text" v-model="name" placeholder="输入双向绑定的值"><span>{{name}}</span>
            </div>
            <button @click="countClick()">count++</button>
        </div>
    </div>
</template>

<script setup>
import {useUserStore} from '@/store/user.js';
import {ref} from 'vue';
import {storeToRefs} from 'pinia'
let inputVa=ref('')
const store=useUserStore();
const {name,count}=storeToRefs(store)
function countClick(){
    // count.value++;
    store.getCount();
}
</script>

<style scoped>
.unitBar{
    width: 100%;
    border: 2px solid #0076ee;
}
.componentTitle{
  width: 100%;
  height: 30px;
  background-color:  #0076ee;
  line-height: 30px;
  text-align: center;
  color: #ffff;
}
.componentInfo{
 margin-left: 20px;
}
.componentInfo input{
    height: 30px;
    width: 200px;
    text-indent: 5px;
    margin: 5px 0;
}
span{
    margin: 0 20px;
}
</style>